<?php
namespace Admin\Controller;

use Common\Controller\AdminbaseController;

class ControlLogController extends AdminbaseController{

    public function index(){
    	if(!empty($_GET['auth_code']) || !empty($_POST['auth_code'])) $where['auth_code'] = $_GET['auth_code'] ? I('get.auth_code') : I('post.auth_code');
      
        $this->assign('auth_code',$where['auth_code']);
		$Wxapp_user   = M('Wxapp_user');
        $count        = $Wxapp_user->where($where)->count();
        $page         = $this->page($count, 15);

        $control_log_list = $Wxapp_user->where($where)->limit($page->firstRow,$page->listRows)->order('last_login_time desc')->select();
        
        //计算几日登陆用户数量
        $time_array = getTimestampArr(1);

        $today_login_customer_count = $Wxapp_user->where("last_login_time between $time_array[0] and $time_array[1]")->count();
        
        $this->assign('today_login_customer_count',$today_login_customer_count);
        $this->assign('list',$control_log_list);
		$this->assign("page", $page->show('Admin'));
	    //   $count   = $Consumption->alias('c')
		//                    ->join('__EVENT__ e on c.event_id = e.id','left')
		//                    ->join('__WXAPP_USER__ w on w.openid = c.wx_openid','left')
		//                    ->order('c.id desc')
		//                    ->where($where)
		//                    ->count();
		// $page  = $this->page($count, 15);
       
		// $consumption_list = $Consumption->alias('c')
		//                                 ->join('__EVENT__ e on c.event_id = e.id','left')
		//                                 ->join('__WXAPP_USER__ w on w.openid = c.wx_openid','left')
		//                                 ->order('c.id desc')
		//                                 ->where($where)
		//                                 ->field('c.id,c.use_time,c.scoreboard_ip,e.event_name,e.auth_code,c.customer_mobile,c.customer_name,w.nickName as wx_nick_name,w.avatarUrl as wx_avatar_url')
		//                                 ->limit($page->firstRow, $page->listRows)
		//                                 ->select();
   
		// //->where($where)->order('id desc')->select();
		// $this->assign('list',$consumption_list);
		// $this->assign("page", $page->show('Admin'));

		// $this->display();
       $this->display();
    }

}